using System;
namespace DreamPark
{
	public class ControleurEntree {
		
		private Parking parking;
		
		public Parking Parking {
			get {return parking;}
			set {parking = value;}
		}
		
		public ControleurEntree (int placesMaxParking) {
			parking = new Parking(placesMaxParking);
			
			for (int i = 0; i < placesMaxParking; i++) {
				parking.AjouterPlace(new Place(i, 0, 400, 400));
			}
		}
		
		public Vehicule GetVehicule(TypeVehicule type, int acces) {
			for (int i = 0; i < this.parking.Acces.Length; i++) {
				if (parking.Acces[i].NumeroAcces == acces) {
					return parking.Acces[i].Camera.CapturerVehicule(type);
				}
			}
			return null;
		}
		
		public Ticket GarerVehicule(int numeroAcces, TypeVehicule type) {
			Ticket ticket = parking.GarerVehicule(numeroAcces, type);
			return ticket;
		}
		
		public bool SortirVehicule(string numeroTicket) {
			return parking.ReprendreVehicule(numeroTicket);
		}
		
		public string GetTempsEcoule(string numeroTicket) {
			return parking.GetTempsEcoule(numeroTicket).ToString();
		}
	}
}

